#ifndef SHA256_H
#define SHA256_H
#include <stdint.h>
#define ROTR(x,n) ((x>>n)|(x<<(32-n)))
#define SHR(x,n) (x>>n)
#define CH(x,y,z) ((x&y)^((~x)&z))
#define MAJ(x,y,z) ((x&y)^(x&z)^(y&z)) 
#define sigma0(i) (ROTR(i,7)^ROTR(i,18)^SHR(i,3))
#define sigma1(i) (ROTR(i,17)^ROTR(i,19)^SHR(i,10))
#define SIGMA0(i) (ROTR(i,2)^ROTR(i,13)^ROTR(i,22))
#define SIGMA1(i) (ROTR(i,6)^ROTR(i,11)^ROTR(i,25))
#define SWAP32(A) ((((uint32_t)(A) & 0xff000000) >> 24) |(((uint32_t)(A) & 0x00ff0000) >> 8) |(((uint32_t)(A) & 0x0000ff00) << 8) |(((uint32_t)(A) & 0x000000ff) << 24))
static const int endianTest = 1;
#define B(A) (*(char *)&endianTest == 1)?SWAP32(A):A
extern uint32_t K[];
extern uint32_t H0[];
void calc_sha256(uint32_t* in,int blocknum,uint32_t* out);
uint32_t* expand(char* in,uint64_t l);

#endif